;Assembler header file for Sound
;written by DefMod (Oct 26 2000) on Tue Dec 12 18:52:46 2000
;Jonathan Coxhead, jonathan@doves.demon.co.uk, 21 Aug 1995

        [       :LNOT: :DEF: Get_Types
        GBLS    Get_Types
        ]
        [       :LNOT: :DEF: Types_Hdr
Get_Types                       SETS    "GET OSLib:oslib.Hdr.Types"
        |
Get_Types                       SETS    ""
        ]
        $Get_Types

        [       :LNOT: :DEF: Get_OS
        GBLS    Get_OS
        ]
        [       :LNOT: :DEF: OS_Hdr
Get_OS                          SETS    "GET OSLib:oslib.Hdr.OS"
        |
Get_OS                          SETS    ""
        ]
        $Get_OS

        [       :LNOT: :DEF: Sound_Hdr
        GBLS    Sound_Hdr

;Symbols for constants
Sound_InstallCode               *       -390234112
Sound_StateRead                 *       &0
Sound_StateOff                  *       &1
Sound_StateOn                   *       &2
Sound_ConfigurationFormat       *       &F
Sound_ConfigurationFormat16BitAny *       &1
Sound_ConfigurationFormat16BitMuLaw *       &2
Sound_ConfigurationOversamplingEnabled *       &10
Sound_DataFlags                 *       &7
Sound_DataInvalid               *       &0
Sound_DataNonNought             *       &1
Sound_DataNought                *       &2
Sound_ReservedFlags             *       &F8
Sound_Hz                        *       1024

;Symbols for structure offsets and sizes
                                ^       0
Sound_LogTable_log              #       8192*Byte
Sound_LogTable                  *       @

                                ^       0
Sound_LogScaleTable_log_scale   #       256*Byte
Sound_LogScaleTable             *       @

                                ^       0
Sound_ChannelHandler_fill_code  #       Ptr
Sound_ChannelHandler_overrun_fixup_code #       Ptr
Sound_ChannelHandler_log_table  #       Ptr
Sound_ChannelHandler_log_scale_table #       Ptr
Sound_ChannelHandler            *       @

                                ^       0
Sound_SCCB_amplitude            #       Byte
Sound_SCCB_voice_no             #       Byte
Sound_SCCB_voice_instance       #       Byte
Sound_SCCB_flags                #       Byte
Sound_SCCB_pitch                #       Int
Sound_SCCB_timbre               #       Int
Sound_SCCB_buffer_fill_count    #       Int
Sound_SCCB_r4                   #       Int
Sound_SCCB_r5                   #       Int
Sound_SCCB_r6                   #       Int
Sound_SCCB_r7                   #       Int
Sound_SCCB_r8                   #       Int
Sound_SCCB_reserved             #       7*Int
Sound_SCCB_available            #       48*Int
Sound_SCCB                      *       @

                                ^       0
Sound_Scheduler_scheduler       #       Ptr
Sound_Scheduler                 *       @

                                ^       0
Sound_VoiceGenerator_fill_code  #       Int
Sound_VoiceGenerator_update_code #       Int
Sound_VoiceGenerator_gate_on_code #       Int
Sound_VoiceGenerator_gate_off_code #       Int
Sound_VoiceGenerator_instantiate_code #       Int
Sound_VoiceGenerator_free_code  #       Int
Sound_VoiceGenerator_install_code #       Int
Sound_VoiceGenerator_voice_name_offset #       Int
Sound_VoiceGenerator            *       @

Sound_State                     *       Int

Sound_Configuration             *       Bits

Sound_LinearHandlerFlags        *       Bits


;Symbols for SWI's and SWI reason codes
XSound_Configure                *       &60140
Sound_Configure                 *       &40140
   ;Entry
   ;  R0 = channel_count (Int)
   ;  R1 = sample_size (Int)
   ;  R2 = sample_period (Int)
   ;  R3 -> channel_handler (Sound_ChannelHandler)
   ;  R4 -> scheduler (Sound_Scheduler)
   ;Exit
   ;  R0 = channel_count_out (Int)
   ;  R1 = sample_size_out (Int)
   ;  R2 = sample_period_out (Int)
   ;  R3 -> channel_handler_out (Sound_ChannelHandler)
   ;  R4 -> scheduler_out (Sound_Scheduler)

XSound_Enable                   *       &60141
Sound_Enable                    *       &40141
   ;Entry
   ;  R0 = state (Sound_State)
   ;Exit
   ;  R0 = state_out (Sound_State)

XSound_Stereo                   *       &60142
Sound_Stereo                    *       &40142
   ;Entry
   ;  R0 = channel_no (Int)
   ;  R1 = position (Int)
   ;Exit
   ;  R1 = position_out (Int)

XSound_Speaker                  *       &60143
Sound_Speaker                   *       &40143
   ;Entry
   ;  R0 = state (Sound_State)
   ;Exit
   ;  R0 = state_out (Sound_State)

XSound_Mode                     *       &60144
Sound_Mode                      *       &40144

SoundMode_ReadConfiguration     *       &0
   ;Entry
   ;  R0 = &0
   ;Exit
   ;  R0 = has_16bit (Bool)
   ;  R1 = configuration (Sound_Configuration)

SoundMode_SetOversampling       *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 = oversample (Bool)
   ;Exit
   ;  R1 = old_oversample (Bool)

XSound_LinearHandler            *       &60145
Sound_LinearHandler             *       &40145
   ;Entry
   ;  R0 = install (Bool)
   ;  R1 -> new_handler_code (code)
   ;  R2 = new_workspace (pointer to Void)
   ;Exit
   ;  R1 -> old_handler_code (code)
   ;  R2 = old_workspace (pointer to Void)

XSound_SampleRate               *       &60146
Sound_SampleRate                *       &40146

SoundSampleRate_ReadCount       *       &0
   ;Entry
   ;  R0 = &0
   ;Exit
   ;  R1 = rate_count (Int)

SoundSampleRate_ReadCurrent     *       &1
   ;Entry
   ;  R0 = &1
   ;Exit
   ;  R1 = rate_index (Int)
   ;  R2 = rate (Int)

SoundSampleRate_Lookup          *       &2
   ;Entry
   ;  R0 = &2
   ;  R1 = rate_index (Int)
   ;Exit
   ;  R2 = rate (Int)

SoundSampleRate_Select          *       &3
   ;Entry
   ;  R0 = &3
   ;  R1 = rate_index (Int)
   ;Exit
   ;  R1 = old_rate_index (Int)
   ;  R2 = old_rate (Int)

XSound_Volume                   *       &60180
Sound_Volume                    *       &40180
   ;Entry
   ;  R0 = volume (Int)
   ;Exit
   ;  R0 = volume_out (Int)

XSound_SoundLog                 *       &60181
Sound_SoundLog                  *       &40181
   ;Entry
   ;  R0 = linear (Int)
   ;Exit
   ;  R0 = log (Int)

XSound_LogScale                 *       &60182
Sound_LogScale                  *       &40182
   ;Entry
   ;  R0 = log (Int)
   ;Exit
   ;  R0 = linear (Int)

XSound_InstallVoice             *       &60183
Sound_InstallVoice              *       &40183
   ;Entry
   ;  R0 -> voice_generator (Sound_VoiceGenerator)
   ;  R1 = voice_no (Int)
   ;Exit
   ;  R0 -> voice_name_out (String)
   ;  R1 = voice_no_out (Int)

SoundInstallVoice_ReadName      *       &0
   ;Entry
   ;  R0 = &0
   ;  R1 = voice_no (Int)
   ;Exit
   ;  R0 -> voice_name (String)

SoundInstallVoice_AddNamedVoice *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 = voice_no (Int)
   ;  R2 -> voice_generator (Sound_VoiceGenerator)
   ;  R3 -> voice_name (String)
   ;Exit
   ;  R1 = voice_no_out (Int)
   ;  R2 -> voice_name_out (String)

SoundInstallVoice_ReadLocalName *       &2
   ;Entry
   ;  R0 = &2
   ;  R1 = voice_no (Int)
   ;Exit
   ;  R2 -> voice_name_out (String)
   ;  R3 -> voice_local_name_out (String)

SoundInstallVoice_ChangeLocalName *       &3
   ;Entry
   ;  R0 = &3
   ;  R1 = voice_no (Int)
   ;  R2 = &0
   ;  R3 -> voice_local_name (String)

XSound_RemoveVoice              *       &60184
Sound_RemoveVoice               *       &40184
   ;Entry
   ;  R1 = voice_no (Int)
   ;Exit
   ;  R0 -> voice_name_out (String)
   ;  R1 = voice_no_out (Int)

XSound_AttachVoice              *       &60185
Sound_AttachVoice               *       &40185
   ;Entry
   ;  R0 = channel_no (Int)
   ;  R1 = voice_no (Int)
   ;Exit
   ;  R0 = channel_no_out (Int)
   ;  R1 = voice_no_out (Int)

XSound_ControlPacked            *       &60186
Sound_ControlPacked             *       &40186
   ;Entry
   ;  R0 = amp_and_channel (Bits)
   ;  R1 = duration_and_pitch (Bits)

XSound_Tuning                   *       &60187
Sound_Tuning                    *       &40187
   ;Entry
   ;  R0 = tuning (Int)
   ;Exit
   ;  R0 = tuning_out (Int)

XSound_Pitch                    *       &60188
Sound_Pitch                     *       &40188
   ;Entry
   ;  R0 = pitch (Int)
   ;Exit
   ;  R0 = accumulator (Int)

XSound_Control                  *       &60189
Sound_Control                   *       &40189
   ;Entry
   ;  R0 = channel_no (Int)
   ;  R1 = amplitude (Int)
   ;  R2 = pitch (Int)
   ;  R3 = duration (Int)

XSound_AttachNamedVoice         *       &6018A
Sound_AttachNamedVoice          *       &4018A
   ;Entry
   ;  R0 = channel_no (Int)
   ;  R1 -> voice_name (String)

XSound_ReadControlBlock         *       &6018B
Sound_ReadControlBlock          *       &4018B
   ;Entry
   ;  R0 = channel_no (Int)
   ;  R1 = offset (Int)
   ;Exit
   ;  R0 = channel_no_out (Int)
   ;  R2 = word (Int)

XSound_WriteControlBlock        *       &6018C
Sound_WriteControlBlock         *       &4018C
   ;Entry
   ;  R0 = channel_no (Int)
   ;  R1 = offset (Int)
   ;  R2 = word (Int)
   ;Exit
   ;  R0 = channel_no_out (Int)
   ;  R2 = word_out (Int)

XSound_QInit                    *       &601C0
Sound_QInit                     *       &401C0
   ;Exit
   ;  R0 corrupted

XSound_QSchedule                *       &601C1
Sound_QSchedule                 *       &401C1
   ;Entry
   ;  R0 = period (Int)
   ;  R1 = swi_no (Int)
   ;  R2 = swi_r0 (Int)
   ;  R3 = swi_r1 (Int)
   ;Exit
   ;  R0 = failed (Bool)

XSound_QRemove                  *       &601C2
Sound_QRemove                   *       &401C2

XSound_QFree                    *       &601C3
Sound_QFree                     *       &401C3
   ;Exit
   ;  R0 = free_count (Int)

XSound_QSDispatch               *       &601C4
Sound_QSDispatch                *       &401C4

XSound_QTempo                   *       &601C5
Sound_QTempo                    *       &401C5
   ;Entry
   ;  R0 = tempo (Int)
   ;Exit
   ;  R0 = tempo_out (Int)

XSound_QBeat                    *       &601C6
Sound_QBeat                     *       &401C6
   ;Entry
   ;  R0 = bar_length (Int)
   ;Exit
   ;  R0 = bar_length_out (Int)

XSound_QInterface               *       &601C7
Sound_QInterface                *       &401C7

Service_Sound                   *       &54
   ;Entry
   ;  R0 = part (Int)
   ;  R1 = &54

Event_StartOfBar                *       &C
   ;Entry
   ;  R0 = &C
   ;  R1 = &2
   ;  R2 = &0

        ]
        END
